package net.sunofbeach.blog.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import net.sunofbeach.blog.pojo.Image;
import com.baomidou.mybatisplus.extension.service.IService;
import net.sunofbeach.blog.pojo.query.ImageQuery;
import net.sunofbeach.blog.response.Result;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * <p>
 *  服务类
 * </p>
 *
 * @author Bing
 * @since 2021-11-24
 */
public interface ImageService extends IService<Image> {

    /**
     * 单文件上传至本地
     *
     * @param original
     * @param file
     * @return
     */
    Result uploadImage(String original, MultipartFile file);


    /**
     * 获取图片
     * @param response
     * @param imageId
     * @throws IOException
     */
    void viewImage(HttpServletResponse response, String imageId) throws IOException;

    /**
     * 条件分页查询图片列表
     * @param pageParam
     * @param query
     * @return
     */
    IPage<Image> selectPage(Page<Image> pageParam, ImageQuery query);
}
